﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Silverlight.Weblog.Client.Default.Widgets.MultipleBlogPostsContentWidget
{
    public class SmoothExpandableContentControl : ContentControl
    {
        private ScrollViewer _scrollViewer = new ScrollViewer()
                                                 {
                                                     HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
                                                     BorderThickness = new Thickness(0)
                                                 };
        public SmoothExpandableContentControl()
        {
            this.Content = _scrollViewer;
        }

        public FrameworkElement ContentOverride
        {
            get
            {
                return (FrameworkElement) this._scrollViewer.Content;
            }
            set
            {
                this._scrollViewer.Content = value;
                //value.SizeChanged += new SizeChangedEventHandler(ContentOverride_SizeChanged);
                //value.LayoutUpdated += new EventHandler(value_LayoutUpdated);
            }
        }

        void value_LayoutUpdated(object sender, EventArgs e)
        {
        }

        void ContentOverride_SizeChanged(object sender, SizeChangedEventArgs e)
        {
        }


        #region Percentage (DependencyProperty)

        public int Percentage
        {
            get { return (int)GetValue(PercentageProperty); }
            set { SetValue(PercentageProperty, value); }
        }
        public static readonly DependencyProperty PercentageProperty =
            DependencyProperty.Register("Percentage", typeof(int), typeof(SmoothExpandableContentControl),
              new PropertyMetadata(0));

        #endregion

    }
}
